package app.kafka.consume;

import app.htby.utils.KafkaConsumeUtils;
import app.htby.utils.SpringContextUtil;

/**
 * 消费分发数据
 * @author lfy.xys
 * @date 2018年6月5日
 *
 */
public class DisWebConsumerRunnable implements Runnable {
	String topic;
	String beanId;

	public DisWebConsumerRunnable(String topic, String beanId) {
		this.topic = topic;
		this.beanId = beanId;
	}

	@Override
	public void run() {
		DisWebConsumer bean = (DisWebConsumer) SpringContextUtil.getBean(beanId);
		KafkaConsumeUtils.topicSet.add(topic);// 已经消费的topic放入 list
		KafkaConsumeUtils.topicCount++;// 数量+1
		bean.consume(topic);// 消费
	}
}
